package com.umeng.analytics;

import android.content.Context;
import android.text.TextUtils;

import com.umeng.analytics.pro.by;
import com.umeng.analytics.social.UMPlatformData;
import com.umeng.analytics.social.UMSocialService;
import com.umeng.analytics.social.d;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.microedition.khronos.opengles.GL10;

public class MobclickAgent {
    public enum EScenarioType {
        E_UM_NORMAL(0),
        E_UM_GAME(1),
        E_UM_ANALYTICS_OEM(224),
        E_UM_GAME_OEM(225);

        private int a;

        private EScenarioType(int i) {
            this.a = i;
        }

        public final int toValue() {
            return this.a;
        }
    }


    public class UMAnalyticsConfig {
        public String mAppkey;
        public String mChannelId;
        public Context mContext;
        public boolean mIsCrashEnable;
        public EScenarioType mType;

        private UMAnalyticsConfig() {

            this.mAppkey = null;
            this.mChannelId = null;
            this.mIsCrashEnable = true;
            this.mType = EScenarioType.E_UM_NORMAL;
            this.mContext = null;
        }

        public UMAnalyticsConfig(Context arg7, String arg8, String arg9) {
            this(arg7, arg8, arg9, null, true);
        }

        public UMAnalyticsConfig(Context arg3, String arg4, String arg5, EScenarioType arg6, boolean arg7) {

            this.mAppkey = null;
            this.mChannelId = null;
            this.mIsCrashEnable = true;
            this.mType = EScenarioType.E_UM_NORMAL;
            this.mContext = null;
            this.mContext = arg3;
            this.mAppkey = arg4;
            this.mChannelId = arg5;
            this.mIsCrashEnable = arg7;
            if (arg6 != null) {
                this.mType = arg6;
            } else {
                switch (AnalyticsConfig.getVerticalType(arg3)) {
                    case 0: {
                        this.mType = EScenarioType.E_UM_NORMAL;
                        return;
                    }
                    case 1: {
                        this.mType = EScenarioType.E_UM_GAME;
                        return;
                    }
                    case 224: {
                        this.mType = EScenarioType.E_UM_ANALYTICS_OEM;
                        return;
                    }
                    case 225: {
                        this.mType = EScenarioType.E_UM_GAME_OEM;
                        return;
                    }
                }
            }
        }

        public UMAnalyticsConfig(Context arg7, String arg8, String arg9, EScenarioType arg10) {
            this(arg7, arg8, arg9, arg10, true);
        }
    }

    private static final String a = "input map is null";
    private static final b b = new b();

    public MobclickAgent() {

    }

    public static void enableEncrypt(boolean arg1) {
        MobclickAgent.b.e(arg1);
    }

    public static b getAgent() {
        return MobclickAgent.b;
    }

    public static void onEvent(Context arg7, String arg8) {
        MobclickAgent.b.a(arg7, arg8, null, -1, 1);
    }

    public static void onEvent(Context arg7, String arg8, String arg9) {
        if (TextUtils.isEmpty(((CharSequence) arg9))) {
            by.c("label is null or empty");
        } else {
            MobclickAgent.b.a(arg7, arg8, arg9, -1, 1);
        }
    }

    public static void onEvent(Context arg6, String arg7, Map arg8) {
        if (arg8 == null) {
            by.e("input map is null");
        } else {
            MobclickAgent.b.a(arg6, arg7, new HashMap(arg8), -1);
        }
    }

    public static void onEvent(Context arg1, List arg2, int arg3, String arg4) {
        MobclickAgent.b.a(arg1, arg2, arg3, arg4);
    }

    public static void onEventValue(Context arg6, String arg7, Map arg8, int arg9) {
        HashMap v3 = arg8 == null ? new HashMap() : new HashMap(arg8);
        v3.put("__ct__", Integer.valueOf(arg9));
        MobclickAgent.b.a(arg6, arg7, ((Map) v3), -1);
    }

    public static void onKillProcess(Context arg1) {
        MobclickAgent.b.d(arg1);
    }

    public static void onPageEnd(String arg1) {
        if (!TextUtils.isEmpty(((CharSequence) arg1))) {
            MobclickAgent.b.b(arg1);
        } else {
            by.e("pageName is null or empty");
        }
    }

    public static void onPageStart(String arg1) {
        if (!TextUtils.isEmpty(((CharSequence) arg1))) {
            MobclickAgent.b.a(arg1);
        } else {
            by.e("pageName is null or empty");
        }
    }

    public static void onPause(Context arg1) {
        MobclickAgent.b.b(arg1);
    }

    public static void onProfileSignIn(String arg1) {
        MobclickAgent.onProfileSignIn("_adhoc", arg1);
    }

    public static void onProfileSignIn(String arg2, String arg3) {
        if (TextUtils.isEmpty(((CharSequence) arg3))) {
            by.d("uid is null");
        } else if (arg3.length() > 64) {
            by.d("uid is Illegal(length bigger then  legitimate length).");
        } else if (TextUtils.isEmpty(((CharSequence) arg2))) {
            MobclickAgent.b.a("_adhoc", arg3);
        } else if (arg2.length() > 32) {
            by.d("provider is Illegal(length bigger then  legitimate length).");
        } else {
            MobclickAgent.b.a(arg2, arg3);
        }
    }

    public static void onProfileSignOff() {
        MobclickAgent.b.b();
    }

    public static void onResume(Context arg1) {
        if (arg1 == null) {
            by.e("unexpected null context in onResume");
        } else {
            MobclickAgent.b.a(arg1);
        }
    }

    public static void onSocialEvent(Context arg1, String arg2, UMPlatformData[] arg3) {
        if (arg1 == null) {
            by.e("context is null in onShareEvent");
        } else {
            d.d = "3";
            UMSocialService.share(arg1, arg2, arg3);
        }
    }

    public static void onSocialEvent(Context arg1, UMPlatformData[] arg2) {
        if (arg1 == null) {
            by.e("context is null in onShareEvent");
        } else {
            d.d = "3";
            UMSocialService.share(arg1, arg2);
        }
    }

    public static void openActivityDurationTrack(boolean arg1) {
        MobclickAgent.b.b(arg1);
    }

    public static void reportError(Context arg1, String arg2) {
        MobclickAgent.b.a(arg1, arg2);
    }

    public static void reportError(Context arg1, Throwable arg2) {
        MobclickAgent.b.a(arg1, arg2);
    }

    public static void setCatchUncaughtExceptions(boolean arg1) {
        MobclickAgent.b.a(arg1);
    }

    public static void setCheckDevice(boolean arg1) {
        MobclickAgent.b.c(arg1);
    }

    public static void setDebugMode(boolean arg1) {
        MobclickAgent.b.d(arg1);
    }

    public static void setLatencyWindow(long arg2) {
        MobclickAgent.b.a(arg2);
    }

    public static void setLocation(double arg2, double arg4) {
        MobclickAgent.b.a(arg2, arg4);
    }

    public static void setOpenGLContext(GL10 arg1) {
        MobclickAgent.b.a(arg1);
    }

    public static void setScenarioType(Context arg1, EScenarioType arg2) {
        MobclickAgent.b.a(arg1, arg2);
    }

    public static void setSecret(Context arg1, String arg2) {
        MobclickAgent.b.b(arg1, arg2);
    }

    public static void setSessionContinueMillis(long arg2) {
        MobclickAgent.b.b(arg2);
    }

    public static void startWithConfigure(UMAnalyticsConfig arg1) {
        if (arg1 != null) {
            MobclickAgent.b.a(arg1);
        }
    }
}

